package com.ganzi.ganziserver.service.imp;

import com.ganzi.ganziserver.core.Role;
import com.ganzi.ganziserver.dao.RoleDao;
import com.ganzi.ganziserver.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImp implements RoleService{

    @Autowired
    RoleDao dao;

    @Override
    public Role findRoleByIdForPermissions(long id) throws Exception {
        Role r = null;
        if(id != 0l){
            r = dao.findRoleByIdForPermissions(id);
        }
        return r;
    }

    @Override
    public List<Role> findAllRoles() throws Exception {
        return dao.findAllRole();
    }
}
